
import React from 'react';
import agent from 'server';
import Controller from 'Controller';
import ICapability from 'components/capability/interfaces/ICapability';
import { message } from 'antd';

/** 保存 */
export const save: ICapability<undefined> = {
    id: 'save',
    title: '保存',
    useExpand: () => {

        const threeController = Controller.instance.useMemo(s => s.threeController, []);

        const onClick = React.useCallback(async () => {
            await agent.post('/api/project/save').send(await threeController.saveData()).over();
            message.success('保存成功')
        }, [threeController])

        return {
            onClick,
        }
    }
}
